#ifndef __VIEW_Ctrl_H_
#define __VIEW_Ctrl_H_

#include "Header.h"

#if CURRENT_PLATFORM == WIN
#	include "Win.h"
#	define VIEWCLASS	Win32
#else //Android
	//
#	define VIEWCLASS	
#endif

template <class T>
class ViewController
{
protected:
	static ViewController* m_pInstance;
	T* m_pView;
protected:
	ViewController() :m_pView(0){}
public:
	static ViewController* GetInstance(){ return m_pInstance; }
	virtual ~ViewController(){ DEL(m_pView); }
	static void CreateView(__uint32_ iWidth, __uint32_ iHeight, const wchar_t* szTitle, __bool_ isFullScreen, __uint32_ iFlag)
	{
		if (!m_pInstance)
		{
			m_pInstance = new ViewController();
#if (CURRENT_PLATFORM == WIN)
			//Create new view
#if CURRENT_DBG_MODE == DBG_BASE
			Device::GetInstance()->LogEx("Create Windows View Task: \n");
#endif
			m_pInstance->m_pView = new T(iWidth, iHeight, szTitle, iFlag);
#if CURRENT_DBG_MODE == DBG_BASE
			Device::GetInstance()->LogEx("Init Windows View Stask: \n");
#endif
			m_pInstance->m_pView->esCreateWindows();
#endif
		}
	}

	static void DestroyInstance()
	{
		if (m_pInstance)
			DEL(m_pInstance);
	}

	T* GetView(){ return m_pView; }
};

#endif